package com.example.demo.controller;

import com.example.demo.config.ERHttpStatus;
import com.example.demo.vo.R;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MyController {

    @RequestMapping("/my/list")
    public R list() {
        R r = new R();
        r.data("success");
        r.message("查询成功");
        return r;
    }

    @RequestMapping("/my/list2")
    public R list2() {
        HttpStatus badGateway = HttpStatus.BAD_GATEWAY;
        return R.ok("success").code(201).message("请求成功");
    }

//    @RequestMapping("/my/list3")
//    public R list3() {
//        return R.error(RHttpStatusEnum.PASSWORD_MISTAKE.code(),
//                RHttpStatusEnum.PASSWORD_MISTAKE.message());
//    }

    @RequestMapping("/my/list4")
    public R list4() {
        return R.error(ERHttpStatus.USER_NOT_EXIST);
    }

}
